package com.banyuan.项目;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ClientSet extends JDialog {
    private JTextField textField;
    private JTextField textField_1;
    private JTextField textField_2;

    private Request request;

    public Request getRequest() {
        return request;
    }

/**
 * Launch the application.
 */




    /**
     * Create the dialog.
     */
    public ClientSet() {
        this.setVisible(true);
        setTitle("用户设置");
        setBounds(100, 100, 368, 231);
        getContentPane().setLayout(null);
        {
            JButton okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
//                    temp.setUserName(textField.getText());
//                    temp.setIpLocation(textField_1.getText());
//                    temp.setPort(textField_2.getText());
                    ClientSet.this.setVisible(false);
                }
            });
            okButton.setBounds(85, 157, 75, 29);
            getContentPane().add(okButton);
            okButton.setActionCommand("OK");
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener((e) -> {
                //Cancel按钮，点击之后退出界面，但是界面还在运行；
                ClientSet.this.setVisible(false);
            });
            cancelButton.setBounds(173, 157, 86, 29);
            getContentPane().add(cancelButton);
            cancelButton.setActionCommand("Cancel");
        }
        {
            JLabel lblNewLabel = new JLabel("请输入用户名：");
            lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT);
            lblNewLabel.setBounds(62, 22, 98, 29);
            getContentPane().add(lblNewLabel);
        }
        {
            textField = new JTextField();
            textField.setBounds(172, 22, 150, 28);
            getContentPane().add(textField);
            textField.setColumns(10);
        }
        {
            JLabel lblip = new JLabel("请输入IP地址：");
            lblip.setHorizontalAlignment(SwingConstants.RIGHT);
            lblip.setBounds(62, 63, 98, 29);
            getContentPane().add(lblip);
        }
        {
            JLabel lblNewLabel = new JLabel("请输入端口号：");
            lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT);
            lblNewLabel.setBounds(62, 104, 98, 29);
            getContentPane().add(lblNewLabel);
        }
        {
            textField_1 = new JTextField();
            textField_1.setColumns(10);
            textField_1.setBounds(172, 63, 150, 28);
            getContentPane().add(textField_1);
        }
        {
            textField_2 = new JTextField();
            textField_2.setColumns(10);
            textField_2.setBounds(172, 105, 150, 28);
            getContentPane().add(textField_2);
        }
    }

}
